<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>组件</title>
</head>

<body>
    <div id="app">
        <ol>
            <todo-item v-for="item in groceryList" v-bind:todo="item" v-bind:key="item.id"></todo-item>
        </ol>
    </div>

    <script type="module">
        import Vue from '../vue.esm.browser.js'

        Vue.component('todo-item', {
            props: ['todo'],
            template: '<li>{{ todo.text }}</li>'
        })
        const app = new Vue({
            el: '#app',
            data: {
                groceryList: [
                    { id: 0, text: '蔬菜' },
                    { id: 1, text: '奶酪' },
                    { id: 2, text: '随便其它什么人吃的东西' }
                ]
            },
        })
    </script>
</body>

</html>